A memory system such as a solid state drive (SSD) may include a nonvolatile semiconductor memory, such as a NAND type flash memory, as a storage area. The nonvolatile semiconductor memory has multiple blocks, and each block includes multiple clusters. In the memory system, when data is rewritten to the nonvolatile semiconductor memory, an efficiency of use might decrease due to invalid clusters in some blocks. Thus, garbage collection (compaction) is executed in a manner wherein, by referring to management information of the number of valid clusters of each block, from a block in which the number of valid clusters is lower than a threshold, data of valid clusters is collected from the block and rewritten to one or more free blocks, and the data in the original block is erased.